﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Utilities
{
    public class NewGuid
    {
        public static Guid create(String prefix)
        {
            if (String.IsNullOrWhiteSpace(prefix))
            {
                prefix = "abcd";
            }
            while (prefix.Length < 4)
            {
                prefix += "a";
            }

            DateTime currentDate = DateTime.Now;
            byte[] bytes = System.BitConverter.GetBytes(currentDate.Ticks);
            byte[] gbytes = Guid.NewGuid().ToByteArray();
            for (int i = 0; i < 6; i++)
            {
                gbytes[10 + i] = bytes[i];
            }
            Guid result = new Guid(gbytes);
            return result;
        }

    }
}
